#pragma once

namespace COMMONLIB
{
	class Lock
	{
	public:
		Lock();
		~Lock();

		class AutoLock
		{
		public:
			AutoLock(Lock& cs);
			~AutoLock();

		private:
			const Lock& m_CS;
		};
		friend AutoLock;
	private:
		mutable CRITICAL_SECTION m_cs;
	};

	class SingleMutex
	{
	public:
		SingleMutex(LPCTSTR name);
		~SingleMutex();

		BOOL IsMutexValid()const;

	public:
		HANDLE m_Mutex;
		BOOL m_IsExists;
	};
}